package com.xy.biz.uc.domain.converter;

import com.xy.biz.uc.domain.bo.TeamUserRelBO;
import com.xy.biz.uc.domain.po.TeamUserRelPO;
import com.xy.biz.uc.domain.query.TeamUserRelQuery;
import com.xy.biz.uc.domain.req.ListTeamUserRelRequest;
import com.xy.biz.uc.domain.req.UpdateTeamUserRelRequest;
import com.xy.biz.uc.domain.resp.GetTeamUserResponse;
import com.xy.tool.util.BeanUtilsEx;

import java.util.Collection;
import java.util.List;

/**
 *
 *
 * @author yzh
 * @date 2021-4-26
 */
public class TeamUserRelConverter {

	public static TeamUserRelPO toPO(TeamUserRelBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new TeamUserRelPO(), true);
	}

	public static List<TeamUserRelPO> toPO(Collection<TeamUserRelBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TeamUserRelPO(), true);
	}

	public static TeamUserRelBO fromPO(TeamUserRelPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new TeamUserRelBO());
	}

	public static TeamUserRelBO toBO(UpdateTeamUserRelRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new TeamUserRelBO());
	}

	public static List<TeamUserRelBO> fromPO(Collection<TeamUserRelPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TeamUserRelBO());
	}

	public static GetTeamUserResponse toResponse(TeamUserRelBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetTeamUserResponse());
	}

	public static List<GetTeamUserResponse> toResponse(Collection<TeamUserRelBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetTeamUserResponse());
	}

	public static TeamUserRelQuery toQuery(ListTeamUserRelRequest source) {
		if(null == source) {
			return null;
		}
		TeamUserRelQuery target = new TeamUserRelQuery();
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}


}
